package com.example.online.music;

import com.example.online.music.model.request.SongRequest;
import com.example.online.music.service.SingerService;
import com.example.online.music.service.SongService;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.web.multipart.MultipartFile;

import java.io.File;

@Slf4j
@SpringBootTest
public class TestSongService {

  @Autowired
  private SongService songService;

  @Test
  public void testAddSong(){
    SongRequest songRequest = new SongRequest();
    songRequest.setName("ceshi");
    songRequest.setSingerId(1);
    //模拟 文件上传中的文件
    MockMultipartFile file = new MockMultipartFile(
            "file",
            "filename.txt",
            "text/plain",
            "File content".getBytes()
    );

    log.info("测试获取全部歌手列表：{}", songService.addSong(songRequest,file));

  }
}
